package hn.sigit.view;

import java.io.IOException;
import java.util.Properties;

import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.AutoCreate;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;

@Name("propertiesHelper")
@Scope(value=ScopeType.APPLICATION)
@AutoCreate
public class PropertiesHelper {
	private static final String PROPERTIES_FILE = "sigit.properties";
	
	private final Properties properties;
	private final String version;
	
	
	public PropertiesHelper() {
		properties = new Properties();

		try {
			ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
			properties.load(classLoader.getResourceAsStream(PROPERTIES_FILE));
		}
		catch (IOException e) {
			System.err.println("ERROR: " + PROPERTIES_FILE + " IS MISSING");
		}
			
		version = properties.get("version").toString();
	}
	public String getVersion() {
		return version;
	}
}
